/*
 * Empty C++ Application
 */
#include "Serial.h"
#include "Timer.h"
#include "hardware.h"
#include "xparameters.h"
#include "xtmrctr.h"
#include "xio.h"
#include "xutil.h"
#include "stdio.h"

int main()
{
		/*
        Xuint32 micro;
        Xuint32 milli;
        int status;
        int teller = 0;
        int interval = 1000;
        Xuint32 t0 = 0;
        Xuint32 t1;

        Serial com1(1);
        com1.begin(9600);
        xil_printf("Debug port \n");


        status = initialize();
        xil_printf("Initializeren, status: %d", status);

        milli = millis();
        xil_printf("millis = %d \n", milli);

        micro = micros();
        xil_printf("micros = %d \n", micro);

        milli = millis();
        xil_printf("millis = %d \n", milli);

        micro = micros();
        xil_printf("micros = %d \n", micro);

        xil_printf("Tellen tot 10 op 1Hz\n");

        while(teller < 10){
                t1 = millis();
                if((t1 - t0)>interval){
                        teller++;
                        xil_printf("%d \n", teller);
                        t0 = t1;
                }
        }

        xil_printf("Tellen tot 10 met delay \n");
        teller = 0;
        while(teller < 10){
                delay(1000);
                teller++;
                xil_printf("%d \n", teller);
        }

        xil_printf("Einde test\n");
        return 0;
*/

	/*

		int test;
		Serial com1(1);
		test = com1.begin(9600);
		xil_printf("com 1 geinit \n");
		com1.write('c');
		Serial com2(2);
		test = com2.begin(9600);
        com2.write('T');
        com1.write('B');

        while(1){}

        return 0;

        */
		int test;
		int milli;

		initialize_InterruptController();

		Serial com1(1);
		test = com1.begin(9600);
		startInterrupt();
		enableInterrupt(getInterruptController(), 0);


		xil_printf("Com 1 is geinit, test is: %d \n", test);
		com1.write();
		xil_printf("\n");
		
		xil_printf("*************************************\n");

		Serial com2(2);
		test = com2.begin(9600);
		startInterrupt();
		enableInterrupt(getInterruptController(), 1);
		xil_printf("Com 2 is geinit, test is: %d \n", test);
		com2.write();


		while(1);
		

		/*
        test = initialize();
        xil_printf("Initializeren, status: %d", test);

        milli = millis();
        xil_printf("millis = %d \n", milli);
        milli = millis();
        xil_printf("millis = %d \n", milli);

        com1.write();


        while(1);
        */

}
